﻿#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "etools.h"
#include <QDebug>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_clicked()    //提取频率数据
{
    double value = -1;
    ETOOLS::stringToNumber( ui->lineEdit->text(), value );
    QString ret = ETOOLS::doubleToStr( value, 9 );
    ui->textEdit->append( ret );

    ETOOLS::EDEBUG(1, "提取数据完成");
}

void MainWindow::on_pushButton_2_clicked()
{
    QString str = ui->lineEdit_2->text();
    ui->textEdit->append( ETOOLS::numberToStringGMK(str.toDouble(), 1000, 9 ) );
}

void MainWindow::on_pushButton_3_clicked()  //提取频率
{
    double value = -1;
    ETOOLS::stringToNumber( ui->lineEdit_3->text(), value );
    QString str = QString::number( value, 'f', 0);
//    qDebug() << str;

    ui->textEdit->append( str );

}

void MainWindow::on_pushButton_4_clicked()  //提取时间
{
    double value = -1;
    ETOOLS::stringToNumber( ui->lineEdit_4->text(), value );
    QString str = QString::number( value, 'f', 0);
//    qDebug() << str;
    ui->textEdit->append( str );
}

void MainWindow::on_pushButton_5_clicked()
{
    double value = -1;
    ETOOLS::stringToNumber( ui->lineEdit_5->text(), value );
    ui->textEdit->append( ETOOLS::doubleToStr(value, 6  ) );
}

void MainWindow::on_pushButton_6_clicked()  //禁用
{
    ETOOLS::comboBoxEnabled( ui->comboBox, QList<int>() << 1 << 3 << 5 , false);
}

void MainWindow::on_pushButton_7_clicked()  //取消禁用
{
    ETOOLS::comboBoxEnabled( ui->comboBox, QList<int>() << 1 << 3 << 5 , true);
}
